<template>
	<view class="content">
		<view class="logo-area">
			<img src="../../static/logo.png"></img>
		</view>
		<view class="title-area">
			<img src="../../static/title.png"></img>
		</view>
		<view class="menu-box">
			<view class="menu-item" @tap="handlePage('qd',userData)">
				<img src="../../static/home/qd.png"></img>
			</view>
			<view class="menu-item" @tap="handlePage('qd',userData)">
				<img src="../../static/home/ch.png"></img>
			</view>
		</view>
		<FootLogo></FootLogo>
	</view>
</template>

<script>
	// import RobotData from '@/components/robot/robot.vue';
	import FootLogo from '@/components/footLogo/index.vue';
	export default {
		components: {
			// RobotData,
			FootLogo
		},
		data() {
			return {
				userData: {}
			}
		},
		onLoad() {
			this.getInfo()
		},
		methods: {

			getInfo() {
				// 网络请求
				uni.showLoading({
					title: '请求中',
				});
				uni.request({
					url: 'https://flow.btvs.cn/api/basic/guest/getInfo',
					method: 'GET',
					header: {
						Authorization: uni.getStorageSync('token')
					},
					dataType: 'json',
					success: (res) => {
						uni.hideLoading();
						if (res.data.code == 200) {
							this.userData = {
								...res.data.data
							}

						} else {
							uni.showToast({
								title: res.data.msg,
								icon: "error"
							})
							if (res.data.code == 401) {
								setTimeout(() => {
									uni.navigateTo({
										url: '/pages/index/index'
									})
								}, 1500)
							}

						}
					},
					fail: () => {
						uni.hideLoading();
						uni.showToast({
							title: '网络开小差了~',
							icon: "error"
						})
					},
				});
			},
			handlePage(path, data) {
				if (path == 'yc') {
					uni.navigateTo({
						url: `../${path}/${path}?type=` + data.guestType
					})
				} else {
					uni.navigateTo({
						url: `../${path}/${path}`
					})
				}

			}
		}
	}
</script>

<style lang="less">
	.content {
		height: 100vh;
		background: url('../../static/index_bg.jpg');
		background-size: cover;
		background-repeat: no-repeat;
		background-position: center;

		.logo-area {
			position: absolute;
			top: 40px;
			left: 40px;
			z-index: 9;

			img {
				width: 380rpx;
				display: block;
			}
		}

		.title-area {
			width: 100%;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;

			img {
				margin-top: -760rpx;
				width: 80%;
				display: block;
			}
		}

		.menu-box {
			width: 80%;
			margin: 0 auto;
			position: absolute;
			bottom: 240rpx;
			left: 10%;

			.menu-item {
				margin-bottom: 60rpx;

				img {
					margin: 0 auto;
					width: 400rpx;
					display: block;
				}
			}

		}


	}
</style>